package cn.coderliu.voteweb.common.util;


import java.security.SecureRandom;
import java.util.UUID;

/**
 * Filename: UUIDUtil.java <br>
 * 
 * Description: <br>
 * 
 * @author: NQY <br>
 * @version: 1.0 <br>
 * @Createtime: Jul 10, 2014 <br>
 * 
 * @Copyright: Copyright (c)2014 by nqy <br>
 * 
 */

public class UUIDUtil {
	private static SecureRandom random = new SecureRandom();
	/**
	 * 获取uuid
	 * @return
	 * @author: NQY  
	 * @Createtime: Jul 10, 2014
	 */
	public static String getUUID() {
		UUID uuid = UUID.randomUUID();
		return uuid.toString().replace("-", "");
	}

	/**
	 * 基于Base62编码的SecureRandom随机生成bytes.
	 */
	public static String randomBase62(int length) {
		byte[] randomBytes = new byte[length];
		random.nextBytes(randomBytes);
		return Encodes.encodeBase62(randomBytes);
	}


}
